const searchCreate = (params: Record<string, string | number | undefined | null>, withQuestion?: boolean): string => {
    return Object.entries(params).reduce(
        (search, [key, value]) =>
            search +
            (value ? (search.length ? `&${key}=${value}` : withQuestion ? `?${key}=${value}` : `${key}=${value}`) : ''),
        '',
    );
};

export default searchCreate;
